package com.gxa.modules.sys.controller;

import com.gxa.common.utils.Result;

import com.gxa.modules.sys.dto.ComboDto;

import com.gxa.modules.sys.dto.MyOrderDto;
import com.gxa.modules.sys.entity.Door;
import com.gxa.modules.sys.entity.RestTime;
import com.gxa.modules.sys.service.ComboService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "充值套餐接口")
@RestController
public class ComboController {

    @Autowired
    private ComboService combotService;


    @PostMapping("/combo/add")
    public Result addCombo(@RequestBody ComboDto comboDto){
        combotService.addCode(comboDto);
        return new Result().ok();

    }
    @ApiOperation(value = "修改充值套餐接口")
    @PutMapping("/update/Combo")
    public Result updateTel(@RequestBody ComboDto comboDto) {
        try {
            this.combotService.updateTel(comboDto);
            return new Result().ok();
        } catch (Exception e) {
            return new Result().error("修改失败");
        }
    }
//    @ApiOperation("充值套餐查询接口")
//    @GetMapping("/combo/{id}")
//    public Result queryAllDetail(@PathVariable("id")Integer id) {
//        ComboDto comboDto = combotService.queryCombo(id);
//        return new Result<>().ok(comboDto);
//
//    }

    @ApiOperation("充值套餐查询接口")
    @GetMapping("/recharge01")
    public Result queryAllDetail() {
        List<ComboDto> comboDtos = combotService.queryCombo();
        return new Result<>().ok(comboDtos);

    }
}

